package com.example.myDesignPatterns.行为型模式.责任链模式Responsibility.用责任链模式处理全局异常.handler;

import cn.hutool.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class DefaultExceptionHandler implements ExceptionHandler {
    @Override
    public boolean supports(Exception exception) {
        return true;
    }

    @Override
    public ResponseEntity<Object> handle(Exception exception) {
        return ResponseEntity.status(HttpStatus.HTTP_ENTITY_TOO_LARGE).body("An unexpected error occurred: " + exception.getMessage());
    }
}